//
//  navigationC.m
//  cangkuAssistant
//
//  Created by admin on 16/10/25.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "navigationC.h"

@interface navigationC ()<UINavigationControllerDelegate>
/**
 *  定义一个属性来保存navC的delegate来解决自定义navC后返回手势失效的问题
 */
@property(nonatomic,weak) id PopDelegate;
@end

@implementation navigationC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.PopDelegate = self.interactivePopGestureRecognizer.delegate;
    self.delegate = self;
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;//将右滑手势去掉
 
}

/**
 *  解决返回手势失效的问题
 */
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    
    if ((viewController == self.viewControllers[0])||(viewController == self.viewControllers[1])) {
        self.interactivePopGestureRecognizer.delegate = self.PopDelegate;
    }else{
        self.interactivePopGestureRecognizer.delegate = nil;
    }
}

/**
 *  解决push时隐藏Tabbar
 */
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
